<% content_for :menu do %>
<%= render :partial => "layouts/menu", :locals => {:incidennnnt => true} %>
<% end %>

<% content_for :filAriane do %>
<div id="fil_ariane">
	<%= link_to 'Accueil', :controller => :supervision %>
	&gt;
	Liste des incidents pour <%= @machine.nom_machine %>
</div>
<% end %>

<h1>Liste des incidents pour <%= @machine.nom_machine %></h1>

<div class="table_machine">
<table>
  <tr>
    <th>Date detection</th>
    <th>Machine</th>
    <th>Type incident</th>
    <th>Date resolution</th>
<th class="cellbouton"></th>
  </tr>

<% @incidents.each do |incident| %>
  <tr>
    <td>
    	<% if incident.date_detection != nil %>
    		<%=h incident.date_detection.strftime("%d/%m/%Y %H:%M:%S") %>
    	<% end %>
    </td>
    <td><%= link_to Machine.find_by_id(incident.machine_id).nom_machine, Machine.find_by_id(incident.machine_id)  %></td>
    <td>
    	<% if @typeInc_loc = TypeIncident.find_by_id(incident.type_incident_id) %>
    		<%= link_to @typeInc_loc.libelle, :controller => :incidents, :action => "showByTypeIncident", :id => incident.type_incident_id %>
    	<% end %>
    </td>
    <td>
    	<% if incident.date_resolution != nil %>
    		<%=h incident.date_resolution.strftime("%d/%m/%Y %H:%M:%S") %>
    	<% end %>
    </td>

    <td><span class="bouton"><%= link_to 'Voir', incident %></span>
	<span class="cog"><%= link_to 'Modifier', edit_incident_path(incident) %></span>
	<span class="delete"><%= link_to 'Supprimer', incident, :confirm => 'Etes-vous sur ?', :method => :delete %></span></td>

	
  </tr>
<% end %>
</table>
</div>
<br />
<span class="undo"><%= link_to 'Retour aux incidents', incidents_path %></span>